require 'vector.rb'

describe Vector, "math" do
  before(:each) do
    @v = Vector.new
  end
  
  it "should return a point of [0, 0] for a length of 0 regardless of angle" do
    @v.l = 0
    
    0.upto(359) do |a|
      @v.a = a
      @v.point.to_a.should == [0, 0]
    end
  end
  
  it "should return a point of [-3.46, 2.0] for length of 4 and angle of 150" do
    @v.l = 4
    @v.a = 150
    
    p = @v.point
    p.x.should be_close(-3.46, 0.01)
    p.y.should be_close(2.0, 0.01)
  end
end